/**
 * @Author: aesoper
 * @Description:
 * @File:  json
 * @Version: 1.0.0
 * @Date: 2020/5/19 21:12
 */

package utils

import "encoding/json"

func Json2String(d interface{}) (string, error) {
	j, err := json.Marshal(d)
	if err != nil {
		return "", err
	}
	return string(j), nil
}

func String2Json(j string, v interface{}) error {
	return json.Unmarshal([]byte(j), v)
}
